﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ePlanet.ArchiveMange.Services;
using DreamBuilder.Common;
using ePlanet.ArchiveMange.DataAccess;
using System.Data;
using ePlanet.ArchiveMange.Models;

namespace ePlanet.ArchiveMange.Business
{
    public class BUSTechArchive : BusinessBase, ITechArchiveService
    {
        TechArchiveDAL dal = new TechArchiveDAL();
        ArchiveCommon commonDal = new ArchiveCommon();

        #region IArchiveBase 成员

        bool IArchiveBase.SaveData(DataSet ds)
        {
            return commonDal.SaveData(ds);
        }

        
        public DataSet GetAttach(string ObjectID, string DBHelperString)
        {
            return commonDal.GetAttach(ObjectID, DBHelperString);
        }

        public bool SaveAttach(DataTable dt_Attach, string objectTableName, string objectID, string DBHelperString)
        {
            return commonDal.SaveAttach(dt_Attach, objectTableName, objectID, DBHelperString);
        }


        /// <summary>
        /// 根据主键删除数据
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool DeleteData(string key)
        {
            return dal.DeleteData(key);
        }
        #endregion

        #region ITechArchiveService 成员

        public ArchiveMangeModal.TECHNOLOGY_ARCHIVEDataTable GetAllDocumenArchivetData()
        {
            return dal.GetAllDocumenArchivetData();
        }

        public ArchiveMangeModal.TECHNOLOGY_ARCHIVEDataTable GetAllDocumenArchivetDataById(string DATAID)
        {
            return dal.GetAllDocumenArchivetDataById(DATAID);
        }

        /// <summary>
        /// 备注：根据DATAID列表取对应档案的详细信息
        /// 时间：2013年1月9日 23:47:41
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public DataTable GetTechArchiveDataByIds(IEnumerable<string> idList)
        {
            return dal.GetTechArchiveDataByIds(idList);
        }

        /// <summary>
        /// 备注：取交接文具数据
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public DataTable GetHandoverDataByIds(IEnumerable<string> idList)
        {
            return dal.GetHandoverDataByIds(idList);
        }

        /// <summary>
        /// 备注：取档案所属年度
        /// 时间：2013年5月9日 23:22:44
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public DataTable GetArchiveDateSpanByIds(IEnumerable<string> idList)
        {
            return dal.GetArchiveDateSpanByIds(idList);
        }

        /// <summary>
        /// 根据类型查询数据
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        public ArchiveMangeModal.TECHNOLOGY_ARCHIVEDataTable GetArchiveByType(string archiveType)
        {
            return dal.GetArchiveByType(archiveType);
        }

        public bool SavePageFile(IList<string> fileIdList, string DATAID)
        {
            return commonDal.SavePageFile(fileIdList, DATAID);
        }

        public DataTable GetPageFileByDATAID(string DATAID)
        {
            return commonDal.GetPageFileByDATAID(DATAID);
        }

        public DataTable GetPageFileByArchiveType(string archiveType)
        {
            return commonDal.GetPageFileByArchiveType(archiveType);
        }

        #endregion



        public bool IsSameSecret(List<Guid> dataIDList)
        {
            return dal.IsSameSecret(dataIDList);
        }

        public byte[] GetAttachContentByID(string dataID, string DBHelperString)
        {
            return this.commonDal.GetAttachContentByID(dataID, DBHelperString);
        }
    }
}
